{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#作业一："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2 as cv\n",
    "im = cv.imread(r'H:\\python-code\\test\\image\\lena.jpg')\n",
    "cv.imshow('Hello, word!', im)\n",
    "cv.waitKey()\n",
    "cv.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#作业二："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2 as cv\n",
    "lena = cv.imread(r'H:\\python-code\\test\\image\\lena.jpg')\n",
    "cv.imshow('lena-blue', lena[:, :, 0])\n",
    "cv.imshow('lena-green', lena[:, :, 1])\n",
    "cv.imshow('lena-red', lena[:, :, 2])\n",
    "lenahsv = cv.cvtColor(lena, cv.COLOR_BGR2HSV)\n",
    "cv.imshow('lenahsv',lenahsv)\n",
    "cv.imshow('lenah', lenahsv[:, :, 0])\n",
    "cv.imshow('lenas', lenahsv[:, :, 1])\n",
    "cv.imshow('lenav', lenahsv[:, :, 2])\n",
    "cv.waitKey()\n",
    "cv.deatroyALLWindows()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\n",
    "由于lena图像原图中的大部分像素偏向于橙红或橙黄，那么他的BGR三个通道中red图像就比较白比较亮；由于绿色像素在图中偏少，所以green图像就比其它\n",
    "两个通道要暗一些，和灰度图相近；原图中蓝色像素比绿色像素多一些但比红色少一些，所以blue图比green图亮一些比red图暗一些。\n",
    "由于lena图像原图中的大部分像素偏向于橙红或橙黄，因为红色色调为0，所以它的HSV三个通道中H图像中偏红或者黄的区域就比较黑，而其他地方就比较白；\n",
    "颜色越接近纯色它的饱和度越高，所以S图像中的帽子上的饰品，头发以及背景里的门框都比较白；由于原图中大部分像素颜色接近于红黄蓝三基色，所以V图像中\n",
    "亮度就显得比较高，和BGR中的red通道图像相似。\n",
    "\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
